package com.project.internship.service.impl;

import com.project.internship.entity.Menu;
import com.project.internship.mapper.MenuMapper;
import com.project.internship.mapper.MenuRoleMapper;
import com.project.internship.service.MenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.internship.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2020-04-15
 */
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {

    @Autowired
    MenuRoleMapper menuRoleMapper;
    @Autowired
    MenuMapper menuMapper;

    @Override
    public List<Menu> getAllMenusWithRole() {
        return menuMapper.getAllMenusWithRole();
    }

    @Override
    public List<Menu> getMenusByRoleId() {
        return menuMapper.getMenusByRoleId(UserUtils.getCurrentUser().getRoleId());
    }
}
